package com.xys.auth.bean;

import com.xys.auth.utils.DateTimeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Orders {
    private String id;

    private String orderNum;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date orderTime;

    private Integer peopleCount;

    private String orderDesc;

    private Integer payType;

    private Integer orderStatus;

    private String productId;

    private String memberId;

    private String orderTimeStr;

    private String orderStatusStr;

    private Product product;

    private Member member;

    private List<Traveller> travellers;

    private String payTypeStr;

    public String getOrderTimeStr(){
        return DateTimeUtils.castToDateStr(orderTime,"yyyy-MM-dd HH:mm");
    }

    public String getOrderStatusStr(){
        if(orderStatus == 1){
            return "支付";
        }else {
            return "未支付";
        }
    }

    public String getPayTypeStr() {
        if (payType == 0) {
            return "支付宝支付";
        } else if (payType == 1) {
            return "微信支付";
        } else {
            return "其他";
        }

    }
}
